

Promise.race2 = function (arr) {
    return new Promise((resolve, reject) => {
        if(!Array.isArray(arr)){
            return reject(new TypeError('Argument is not iterable'))
        }//这一步忘写了
        arr.forEach(item => {
            Promise.resolve(item).then(res => resolve(res), error => reject(error))
        });//很妙
    })
}
const p = new Promise((resolve, reject) => {
    resolve('成功咯哈哈')
})
Promise.race().then(res => console.log(res), error => console.log(error, 'error'))
Promise.race2([]).then(res => console.log(res), error => console.log(error, 'error'))